<template>
  <div class="block">
    <span class="demonstration">{{ title }}</span>
    <el-date-picker
      @change="selectTime"
      v-model="time"
      @focus="focus"
      @blur="blur"
      format="YYYY:MM:DD HH:mm:ss"
      type="datetime"
      placeholder="选择日期时间"
    >
    </el-date-picker>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      required: true,
    },
    time: {
      type: String,
    },
  },

  data() {
    return {
      defaultTime: new Date(2000, 1, 1, 12, 0, 0),
    };
  },
  mounted() {},
  methods: {
    selectTime() {
      this.$emit("selectTimes", this.value);
    },
    focus() {
      const timer = document.querySelector(".el-popper");
      timer.style.display = "block";
    },
    blur() {
      const timer = document.querySelector(".el-popper");
      timer.style.display = "none";
    },
  },
};
</script>
